interface KHTMLElement {
    /**
     * 删除样式类型
     * @param className 样式类型名
     */
    removeClass(className: string): KHTMLElement;
    /**
     * 删除样式类型
     * @param className 样式类型名正则表达式
     */
    removeClass(className: RegExp): KHTMLElement;
}
{
    Object.defineProperty(KHTMLElement.prototype, 'removeClass', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: U.F.overloading('DOM-removeClass',
            {
                types: [Etype.string],
                fn: function (this: KHTMLElement, className: string) {
                    className = className.trim();
                    if (U.S.isEmpty(className)) { return this; }
                    if (!U.D.RclassName.test(className)) { return this; }
                    if (className.includes(' ')) {
                        className.split(' ').forEach(cls => {
                            if (U.S.isEmpty(cls)) { return this; }
                            this.elements.forEach(ele => { ele.classList.remove(cls); });
                        });
                    } else {
                        this.elements.forEach(ele => { ele.classList.remove(className); });
                    }
                    return this;
                }
            },
            {
                types: [Etype.RegExp],
                fn: function (this: KHTMLElement, regex: RegExp) {
                    this.elements.forEach(ele => {
                        for (let i = ele.classList.length - 1; i >= 0; i--) {
                            const cls = ele.classList[i];
                            regex.lastIndex = 0;
                            if (regex.test(cls)) {
                                ele.classList.remove(cls);
                            }
                        }
                    });
                    return this;
                }
            },
        )
    });
}
